<template>
	<view class="order_inform">
		<text class="title">订单信息</text>
		<view class=" orderlist">
			<view class="inform">
				<view style="margin: 2px 2px;">订单号：{{orderNo}}</view>
				<view style="margin: 2px 2px;">服务项目：{{project}}</view>
				<view style="margin: 2px 2px;">下单时间：{{orderTime}}</view>
				<view style="margin: 2px 2px;">预约时间：{{bookTime}}</view>
				<view style="margin: 2px 2px;">车辆型号：{{model}}</view>
				<view style="margin: 2px 2px;">备注：</view>
			</view>
		</view>

		<text class="title">订单详情</text>
		<view class="order_details orderlist">
			<view class="detail">
				<view style="margin: 10px; padding-right: 20px;">
					<text>车辆精洗</text>
					<text style="color: #000; float: right;">￥ 199</text>
				</view>
				<view style="margin: 10px; padding-right: 20px;">
					<text>车辆附加费用</text>
					<text style="color: #000; float: right;">￥ 199</text>
				</view>
			</view>
		</view>

		<view class="order_details orderlist">
			<view class="detail">
				<view style="margin:10px; ">
					<text>原价</text>
					<text style="color: #000; float: right;">￥ 100</text>
				</view>
				<view style="margin: 10px;  border-bottom: 1px solid #000;">
					<text>优惠</text>
					<text style="color: red; float: right; ">—￥ 10</text>
				</view>
				<view style="margin: 10px; ">
					<text>支付金额</text>
					<text style="color:  #000; float: right;">￥ 1000</text>
				</view>
			</view>
		</view>
		<!-- 模态框 -->
		<view class="modal" v-if="isModalVisible ">
			<view class="modal-content">
				<image class="qrcode" src="/static/qrcode.jpg" mode="aspectFit"></image>
				<button type="warn" @click="hideModal" class="close">关闭</button>
			</view>
		</view>

		<view>
			<!-- 提示窗示例 -->
			<uni-popup ref="alertDialog" type="dialog">
				<uni-popup-dialog :type="msgType" cancelText="关闭" confirmText="同意" title="正在取消订单" content="确认取消订单吗？"
					@confirm="dialogConfirm" @close="dialogClose"></uni-popup-dialog>
			</uni-popup>
		</view>
		<view>
			<!-- 提示信息弹窗 -->
			<uni-popup ref="message" type="message">
				<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
			</uni-popup>
		</view>
		<view class="anniu">
			<button size="mini" plain="true">联系客服</button>
			<button size="mini" class="slider-area_appraise" plain="true" @click="dialogToggle('取消订单')">取消订单</button>
			<button size="mini" class="slider-area_again" @click="showModal">立即支付</button>
		</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderNo: 'f820391272917233',
				project: '车辆保养',
				stores: '大宝维修点',
				orderTime: '2024-03-30 22:18:18',
				bookTime: '2024-03-30 22:18:18',
				model: '奔驰FWE4/豫A98FHJ',
				isModalVisible: false,
				type: 'center',
				msgType: '取消订单',
				messageText: '这是一条成功提示',
				value: ''
			}
		},
		onLoad(option) {
			console.log(option);
			this.orderNo = option.orderNo

		},
		methods: {

			dialogToggle(type) {
				this.msgType = type
				console.log(this.$refs);
				this.$refs.alertDialog.open()
			},
			dialogConfirm() {
				console.log('点击确认')
				this.messageText = `点击确认了 ${this.msgType} 窗口`
				this.$refs.message.open()
			},
			dialogConfirm() {
				console.log('点击确认')
				this.messageText = `点击确认了 ${this.msgType} 窗口`
				this.$refs.message.open()
			},
			dialogClose() {
				console.log('点击关闭')
			},
			// 显示模态框
			showModal() {
				this.isModalVisible = true
			},

			// 隐藏模态框  
			hideModal() {
				this.isModalVisible = false
			},

		}
	}
</script>

<style scoped>
	.order_inform {
		background-color: #ffffff;
		padding-bottom: 23px;
		font-weight: 600;
		/* height: 615px; */
	}

	.title {
		display: block;
		padding: 0 10px;
		margin-top: 10px;
		/* background-color: aqua; */
		font-size: 18px;
	}

	.orderlist {
		background-color: white;
		margin: 0 auto;
		width: 95vw;
		/* height: 22vh; */
		margin-top: 20rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		box-shadow: 3rpx 3rpx 3rpx 2rpx rgba(0, 0, 0, 0.2);
	}

	.order_details {
		padding: 10px 0;
		/* height: 80px; */
	}

	.slider-area_appraise {
		border: 1px solid #55aaff;
		margin: 0 20px;

	}

	.slider-area_again {
		background-color: #55aaff;
		color: #fff;
		margin: 0 10px;
	}

	.anniu {
		display: flex;
		font-size: 12px;
		color: #686868;
		margin: 120px 18px 0px 11px;
	}


	.modal {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0, 0, 0, 0.5);
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.modal-content {
		background-color: white;
		padding: 10px;
		border-radius: 10px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.qrcode {
		width: 200px;
		height: 200px;
		margin-bottom: 20px;
	}

	.close {
		width: 100px;
		height: 50px;
	}
</style>